---
layout: m1x_soap
title: Memo Create
---

<h3><a name="order_creditmemo.create-Module%3AOrderCreditMemoAPI"></a>Module: Order Credit Memo API</h3>

<h4><a name="order_creditmemo.create-Resource%3Asalesordercreditmemo"></a>Resource: sales_order_creditmemo</h4>

<h5><a name="order_creditmemo.create-Aliases%3Aordercreditmemo"></a>Aliases: order_creditmemo</h5>

<h5><a name="order_creditmemo.create-Method%3A"></a>Method:</h5>

<ul>
	<li>order_creditmemo.create (SOAP V1)</li>
	<li>salesOrderCreditmemoCreate (SOAP V2)</li>
</ul>


<p>Allows you to create a new credit memo for the invoiced order. Comments can be added and an email notification can be sent to the user email.</p>

<p><b>Arguments:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
<tr>
<td> string </td>
<td> orderIncrementId </td>
<td> Order increment ID </td>
</tr>
<tr>
<td> array </td>
<td> creditmemoData </td>
<td> Array of salesOrderCreditmemoData (optional) </td>
</tr>
<tr>
<td> string </td>
<td> comment </td>
<td> Comment text (optional) </td>
</tr>
<tr>
<td> int </td>
<td> notifyCustomer </td>
<td> Notify customer by email flag (optional) </td>
</tr>
<tr>
<td> int </td>
<td> includeComment </td>
<td> Include comment text into an email notification (optional) </td>
</tr>
<tr>
<td> string </td>
<td> refundToStoreCreditAmount </td>
<td> Payment amount to be refunded to the customer store credit (optional) </td>
</tr>
</tbody></table>


<p><b>Return:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> result </td>
<td> Created credit memo increment ID </td>
</tr>
</tbody></table>


<p>The <b>salesOrderCreditmemoData</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> array </td>
<td> qtys <br class="atl-forced-newline" /> </td>
<td> Array of orderItemIdQty </td>
</tr>
<tr>
<td> double </td>
<td> shipping_amount <br class="atl-forced-newline" /> </td>
<td> Refund shipping amount (optional) <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td> double </td>
<td> adjustment_positive <br class="atl-forced-newline" /> </td>
<td> Adjustment refund amount (optional) <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td> double </td>
<td> adjustment_negative <br class="atl-forced-newline" /> </td>
<td> Adjustment fee amount (optional) <br class="atl-forced-newline" /> </td>
</tr>
</tbody></table>


<p>The <b>orderItemIdQty</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> int </td>
<td> order_item_id <br class="atl-forced-newline" /> </td>
<td> Order item ID to be refunded </td>
</tr>
<tr>
<td> double </td>
<td> qty <br class="atl-forced-newline" /> </td>
<td> Items quantity to be refunded </td>
</tr>
</tbody></table>


<p><b>Faults:</b></p>


<table><tbody>
<tr>
<th> Fault Code </th>
<th> Fault Message </th>
</tr>
<tr>
<td> 102 </td>
<td> Invalid data given. Details in error message. </td>
</tr>
<tr>
<td> 103 </td>
<td> Requested order does not exist. </td>
</tr>
<tr>
<td> 105 </td>
<td> Money can not be refunded to the store credit account as order was created by guest. </td>
</tr>
<tr>
<td> 106 </td>
<td> Credit memo for requested order can not be created. </td>
</tr>
</tbody></table>


<h4><a name="order_creditmemo.create-Examples"></a>Examples</h4>

<h5><a name="order_creditmemo.create-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires api authentification,
// then get a session token
$session = $client-&gt;login('apiUser', 'apiKey');

$result = $client-&gt;call($session, 'order_creditmemo.create', '200000010');
var_dump ($result);</pre>
		</div>
</div></div>

<h5><a name="order_creditmemo.create-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy-&gt;login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy-&gt;salesOrderCreditmemoCreate($sessionId, '200000010');
var_dump($result);</pre>
		</div>
</div></div>



<h5><a name="order_creditmemo.create-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey')); 
 
$result = $proxy-&gt;salesOrderCreditmemoCreate((object)array('sessionId' =&gt; $sessionId-&gt;result, 'creditmemoIncrementId' =&gt; '200000010', 
'creditmemoData' =&gt; array(
'qtys' =&gt; array(
'order_item_id' =&gt; 3,
'qty' =&gt; '1'),
'shipping_amount' =&gt; null,
'adjustment_positive' =&gt; '0',
'adjustment_negative' =&gt; null),
'comment' =&gt; 'comment for credit memo',
'notifyCustomer' =&gt; null,
'includeComment' =&gt; 1,
'refundToStoreCreditAmount' =&gt; '1'
));   
var_dump($result-&gt;result);</pre>
		</div>
</div></div>

<?php include(__ROOT__ . 'footer.php'); ?>
